import { info } from "./url"

async function GetFiq(id) {
  return uni.request({
    url: `${info.url}/fiq`,
    data: { id },
    method: "GET"
  });
}

async function PutFiq(id, department, title, detailed, isUsed, startId) {
  return uni.request({
    url: `${info.url}/fiq`,
    data: { id, department, title, detailed, isUsed, startId },
    method: "PUT"
  });
}

async function DeleteFiq(id) {
  return uni.request({
    url: `${info.url}/fiq/${id}`,
    method: "DELETE"
  });
}

async function PostFiq(department, title, detailed, startId) {
  return uni.request({
    url: `${info.url}/fiq`,
    data: { department, title, detailed, startId },
    method: "POST"
  });
}

async function setting(id, qusetionId, choiceId, next) {
  return uni.request({
    url: `${info}/fid/setting`,
    data: { id, qusetionId, choiceId, next },
    method: "PUT"
  });
}
async function commit(answers, userId) {
  return uni.request({
    url: `${info}/commit`,
    data: { answers, userId },
    method: "POST"
  });
}

export default { GetFiq, PutFiq, DeleteFiq, PostFiq, setting, commit };
